import { Controller, Post, UseInterceptors, UploadedFiles } from '@nestjs/common';
import { FileFieldsInterceptor } from '@nestjs/platform-express'

@Controller('upload')
export class UploadController {
    @Post()
    @UseInterceptors(FileFieldsInterceptor([
        {
            name: 'files',
            maxCount: 9
        }
    ]))
    async uploadFile(@UploadedFiles() file) {
        // console.log(file.files)
        return file.files.map(file => '/public/' + file.filename)
    }
}
